package com.itheima.StringBuilder;

import java.util.Scanner;

/**
 * @Author 王加鑫
 * @Date 2021/4/28 10:53
 * @Version 1.0
 * StringBuilder实现字符串的反转
 */
public class ReverseTest {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个字符串:");
        String s = sc.nextLine();
        //将String转化成StringBuilder
        StringBuilder sb = new StringBuilder(s);
        //实现字符串的反转
        String s2 = sb.reverse().toString();
        if(s2.equals(s)){
            System.out.println("是对称字符串");
        }else {
            System.out.println("不是对称字符串");
        }
    }
}
